<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="/fuman/js/order.js"></script>
<title>添加工厂扫件规则</title>
<script type="text/javascript">
	function checkDecimal(obj,flag) {
		if(flag == 1){
			var decimalReg=/^\d{0,9}\)?$/; //只能输入数字
		}
		if(flag == 2){
			var decimalReg = /^\d+(?=\.{0,1}\d+$|$)/; //可以输入数字或小数点
		}
		if(obj.value!=""&&decimalReg.test(obj.value)){
		}else {
			if (obj.value != "") {
				obj.value = 0
			}
		}
	}
	function saveScanRules() {
		var name = $("#name").val();
		if(!name){
			alert("请填写规则名");return false;
		}
		if(!$("#shopnameid").val()){
			alert("请选择相关店铺");return false;
		}
		if(!$("#countryid0").val()){
			alert("请选择相关国家");return false;
		}
		if(!$("#logisticsID").val()){
			alert("请选择匹配物流方式");return false;
		}
		AWS.ajax_post($('#theFrom'));
	}
</script>
<body class="withvernav">
<div class="bodywrapper">
	{{include file='/public/leftmenu.tpl'}}
	<div class="centercontent">

		<div class="pageheader notab">
			<h1 class="pagetitle">添加工厂扫件规则</h1>
            <span class="pagedesc">说明：1.查询注意事项：勾中反选即不包含后面设定的条件，例如国家选择：美国；勾中反选即所有不为美国的国家．<br>
             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>
			<div class="menulist">
				<ul class="profile_summary">
				</ul>
			</div>
		</div><!--pageheader-->

		<div id="contentwrapper" class="contentwrapper">

			<div id="basicform" class="subcontent">
				<form class="stdform stdform2"  id="theFrom" method="post" action="/factory/saveScanRules">
					<p>
						<label>规则名称</label>
                            <span class="field">
                          <input type="text" name="name" id="name" class="width300" value="{{$detail.name}}" placeholder="请输入名称">
                          <span id="namerr"></span>
                            </span>
					</p>
					<p>
						<label>店铺</label>
                            <span class="field">
                            <textarea name="shopname"  id="shopnameid" cols="5" rows="5">{{$detail.shopname}}</textarea>
                         	<span><br>  <INPUT name="shopflag" value="1"  {{if $detail.shopflag==1}} checked{{/if}} type="checkbox" >
                       	    反选&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onClick="selectShop()"><font color="#003399">选择店铺</font></a></span>
                            </span>
					</p>
					<p>
						<label>国家
						</label>
                            <span class="field">

                          <textarea name="country"  id="countryid0" cols="8" rows="5">{{$detail.country}}</textarea>
                          <span><br>  <INPUT name="countryflag" value="1" {{if $detail.countryflag==1}} checked{{/if}} type="checkbox" >
                       	    反选&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onClick="selectCountry(0)"><font color="#003399">选择国家</font></a></span>
                          </span>
					</p>
					<p>
						<label>买家支付运费 	</label>
                            <span class="field">
                          <input type="text" name="freight1" id="freight1" class="width100" value="{{$detail.freight1}}" onBlur="checkDecimal(this,2)"> -
                          <input type="text" name="freight2" id="freight2" class="width100" value="{{$detail.freight2}}" onBlur="checkDecimal(this,2)"> RMB
                           </span>
					</p>
					<p>
						<label>订单总重量 </label>
                            <span class="field">
                          <input type="text" name="weight1" id="weight1" class="width100" value="{{$detail.weight1}}" onBlur="checkDecimal(this,1)"> -
                          <input type="text" name="weight2" id="weight2" class="width100" value="{{$detail.weight2}}" onBlur="checkDecimal(this,1)"> 克
                          </span>
					</p>
                    	<p>
						<label>订单总金额 </label>
                            <span class="field">
                          <input type="text" name="ordermoney1" id="ordermoney1" class="width100" value="{{$detail.ordermoney1}}" onBlur="checkDecimal(this,2)"> -
                          <input type="text" name="ordermoney2" id="ordermoney2" class="width100" value="{{$detail.ordermoney2}}" onBlur="checkDecimal(this,2)"> 元
                          </span>
					</p>
					<p>
						<label>延迟天数（大于等于） </label>
                            <span class="field">
                          <input type="text" name="days" id="days" class="width100" value="{{$detail.days}}" onBlur="checkDecimal(this,1)"> 天
                          </span>
					</p>
					<p>
						<label>匹配物流方式	</label>
                            <span class="field">
                            <SELECT id="logisticsID" name="logisticsID" width="200">
	                            <OPTION value="">---请选择配送方式---</OPTION>
	                            {{foreach from=$express item=li key=key}}
	                            <OPTION value="{{$li.id}}" {{if $detail.logisticsID==$li.id}}selected{{/if}}>{{$li.name}}</OPTION>
	                            {{/foreach}}
                            </SELECT>
                            </span>
					<p>
						<label>优先级设置	</label>
                             <span class="field">
                                <input type="text" name="priority" id="priority" class="width200" value="{{$detail.priority}}" placeholder="请输入优先级" onBlur="checkDecimal(this,1)">
	                            (优先级为整数格式，数值越小，优先级越高,若同等级，则根据最新操作时间排序)
                            </span>
					</p>
					<p class="stdformbutton">
                        	<span >
                            <input type="hidden" name="id" value="{{$detail.id}}" id="id">
                            <button type="button" class="submit radius2" id="btn" onClick="saveScanRules()">保存</button></span>
					</p>
				</form>

				<br />

			</div><!--subcontent-->

			<!--subcontent-->

		</div><!--contentwrapper-->

	</div><!-- centercontent -->


</div><!--bodywrapper-->





</body>
</html>
